import * as homeApi from '@/api/home.js';

export default {
  namespaced: true,
  state() {
    return {
      category: [
        // {
        //   id: 101230120,
        //   name: '居家'
        // }
      ],
      clothes: [],
    };
  },
  mutations: {
    SET_CATEGORY(state, newValue) {
      state.category = newValue;
    },
    SET_CLOTHES(state, newValue) {
      state.clothes = newValue;
    },
  },
  actions: {
    async updateCategory({ commit }) {
      const res = await homeApi.getCategory();
      commit('SET_CATEGORY', res);
    },
    async updateClothes({ commit }) {
      const res = await homeApi.getClothes();
      commit('SET_CLOTHES', res);
    },
  },
};
